package top.xiaozhaobk.xiaofenshu.user.relation.biz.domain.mapper;

import org.apache.ibatis.annotations.Param;
import top.xiaozhaobk.xiaofenshu.user.relation.biz.domain.dataobject.FollowingDO;

import java.util.List;

/**
 * <p>
 * 用户关注表 Mapper 接口
 * </p>
 *
 * @author xiaozhao
 * @since 2025-01-07
 */
public interface FollowingDOMapper{
    /**
     * 根据用户ID查询关注列表
     * @param userId
     * @return
     */
    List<FollowingDO> selectByUserId(Long userId);

    /**
     * 插入数据
     * @param followingDO
     * @return
     */
    int insert(FollowingDO followingDO);

    /**
     * 根据用户ID和被关注用户ID删除数据
     * @param userId
     * @param unfollowUserId
     * @return
     */
    int deleteByUserIdAndFollowingUserId(@Param("userId") Long userId,
                                         @Param("unfollowUserId") Long unfollowUserId);

    /**
     * 查询记录总数
     *
     * @param userId
     * @return
     */
    long selectCountByUserId(Long userId);

    /**
     * 分页查询
     * @param userId
     * @param offset
     * @param limit
     * @return
     */
    List<FollowingDO> selectPageListByUserId(@Param("userId") Long userId,
                                             @Param("offset") long offset,
                                             @Param("limit") long limit);

    /**
     * 查询关注用户列表
     * @param userId
     * @return
     */
    List<FollowingDO> selectAllByUserId(Long userId);

}
